home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / borland / prbgi097.zip / C.ZIP / PRTGRAPH.H < prev    next >
C/C++ Source or Header  |  1992-12-15  |  13KB  |  317 lines

  1. /*
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  */
  5.  /*   Header file */
  6.  
  7. #ifndef __PRTGRAPH_H__
  8. #define __PRTGRAPH_H__
  9.  
  10. #if   !defined(__LARGE__) && !defined(__HUGE__)
  11.    #error PRTgraph library will run only in LARGE memory model.
  12. #endif
  13.  
  14.  
  15. #if   !defined(_PRT__pascal)
  16.       #define  _PRT__pascal
  17. #endif
  18.  
  19.  
  20.  #define PRT_NO_MEMORY           1
  21.  #define PRT_WRONG_PARAMETERS    2
  22.  #define BGI_WRONG_PARAMETERS    2
  23.  #define PRT_NOT_INITIALIZED     3
  24.  #define PRT_IO_ERROR            4
  25.  #define PRT_ERROR               5
  26.  #define PRT_NO_FILE             6
  27.  #define PRT_USER_INTERRUPT      7
  28.  
  29.  
  30.  /*   drivers  */
  31.  
  32.  #define STAR_SR9    1     /* Epson ????, Star SR  */
  33.  #define IBM9        2     /* IBM GraphPrinter, ProPrinter  */
  34.  #define EPSON9      2     /* EPSON,CITIZEN ( graphic mode: Esc,'K'/'L'/'Y'/'Z' ) */
  35.  #define EPSON9II    3     /* EPSON,CITIZEN ( graphic mode: Esc,'*',n )     */
  36.  #define PANASONIC9  4     /* Panasonic KX-P1124 - not tested */
  37.  #define IBM9c       5     /* IBM ProPrinter (color) */
  38.  #define EPSON9c     5     /* EPSON (color) (graphic mode: Esc,'K'/'L'/'Y'/'Z') */
  39.  #define EPSON9IIc   6     /* EPSON (color) - (graphic mode: Esc,'*',n) */
  40.  #define EPSON24     7     /* 24 pins EPSON compatible printer */
  41.  #define IBM24       8     /* 24 pins IBM compatible printer */
  42.  #define EPSON24c    9     /* 24 pins EPSON compatible color printer */
  43.                            /*  not tested */
  44.  #define IBM24c     10     /* 24 pins IBM compatible color printer */
  45.                            /*  not tested */
  46.  #define PaintJet    11    /* general Paint Jet  */
  47.  #define HPPaintJet  12    /* HP Paint Jet */
  48.  #define HPLJ        13    /* Laser Jet    */
  49.  #define HPLJII      14    /* HP Laser Jet */
  50.  /* #define HPLJIII     12  */
  51.  /* #define POSTSCRIPT  13  */
  52.  /* #define ROLANDP  14     */
  53.  
  54.  /* modes for particular drivers */
  55.    /* EPSON9   */
  56.       #define  EPSON9_60x72      0
  57.       #define  EPSON9_120x72     1
  58.       #define  EPSON9_120x216    2
  59.       #define  EPSON9_240x216    3
  60.    /* STAR_SR9    */
  61.       #define  STAR_SR9_60x72        0
  62.       #define  STAR_SR9_120x72       1
  63.       #define  STAR_SR9_120x144      2
  64.       #define  STAR_SR9_240x144      3
  65.    /* IBM9     */
  66.       #define  IBM9_60x72        0
  67.       #define  IBM9_120x72       1
  68.       #define  IBM9_120x216      2
  69.       #define  IBM9_240x216      3
  70.    /* EPSON24  */
  71.       #define  EPSON24_60x180     0
  72.       #define  EPSON24_120x180    1
  73.       #define  EPSON24_180x180    2
  74.       #define  EPSON24_360x180    3
  75.       #define  EPSON24_360x360    4
  76.    /* IBM24    */
  77.       #define  IBM24_60x180     0
  78.       #define  IBM24_120x180    1
  79.       #define  IBM24_180x180    2
  80.       #define  IBM24_360x180    3
  81.    /* PaintJet   */
  82.       #define  PaintJet_90x90        0
  83.       #define  PaintJet_180x180      1
  84.       #define  PaintJet_90x90c       2
  85.       #define  PaintJet_180x180c     3
  86.    /* HPPJ   */
  87.       #define  HPPJ_90x90        0
  88.       #define  HPPJ_180x180      1
  89.       #define  HPPJ_90x90c       2
  90.       #define  HPPJ_180x180c     3
  91.    /* HP LaserJet   */
  92.       #define  HPLJ_75x75        0
  93.       #define  HPLJ_100x100      1
  94.       #define  HPLJ_150x150      2
  95.       #define  HPLJ_300x300      3
  96.    /* HPLJII   */
  97.       #define  HPLJII_75x75        0
  98.       #define  HPLJII_100x100      1
  99.       #define  HPLJII_150x150      2
  100.       #define  HPLJII_300x300      3
  101.  
  102.  
  103.  
  104. #include "BGI2.h"
  105.  
  106.  
  107. typedef  unsigned char  byte;
  108.  
  109.  
  110. #define PRT_HaltValue 100
  111. extern volatile byte PRT_DATA pascal PRT_HaltPrinting;
  112.  
  113.  
  114.  /*   F U N C T I O N S    P R O T O T Y P E S  */
  115.  
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119.  
  120. int  PRT_FUNC PRT_LinkDrivers(void);
  121. int  PRT_FUNC PRT_ReadDrivers
  122.      ( const char PRT__FAR_PTR* path, const char PRT__FAR_PTR* filename );
  123. int PRT_FUNC PRT_End(void);
  124.  
  125. int PRT__HUGE_PROC pascal PRT_SetPrinterDrv ( unsigned drv, unsigned mode );
  126. int PRT__HUGE_PROC pascal PRT_SetPictureInch ( unsigned width, unsigned height,
  127.                                            unsigned options );
  128. int PRT__HUGE_PROC pascal PRT_SetPicturePix ( unsigned hPix, unsigned vPix,
  129.                                               unsigned options );
  130. int PRT_FUNC PRT_SetDriver ( unsigned drv, unsigned mode,
  131.                             unsigned width, unsigned height,
  132.                             unsigned options );
  133.    #define  PRT_NORMAL     0
  134.    #define  PRT_ROTATE     1
  135.    #define  PRT_INVERSE    2
  136.    #define  PRT_REVERSE    2
  137.  
  138. int PRT_FUNC PRT_SetDriverFName ( const char PRT__FAR_PTR* fname );
  139.  
  140. int PRT_FUNC  PRT_FormFeedNeeded ( int ffneeded );
  141.  
  142. // #if ForPascal
  143.    typedef int far *PRT__handleT; /* pointer to Pascal File */
  144. // #else
  145. //   typedef int   PRT__handleT;
  146. // #endif
  147.  
  148. unsigned PRT_FUNC PRT_Version(void);
  149.  
  150.  
  151.  /* Procedures which may be called before initializing PBGI */
  152. int  PRT_FUNC PRT_Buffer ( void far *address, long size, int usable );
  153. int  PRT_FUNC PRT_EMSBuffer ( int EMShandle, long size, int usable );
  154. int  PRT_FUNC PRT_XMSBuffer ( int XMShandle, long size, int usable );
  155. int   PRT_FUNC   PRT_SetBuffer ( long size, unsigned BufOpt );
  156.       #define  NotUseEMS   1
  157.       #define  NotUseXMS   2
  158.  // int PRT_FUNC PRT_DefineWorld ( unsigned MaxX, unsigned MaxY );
  159.  int  PRT_FUNC   PRT_SetOutName ( const char PRT__FAR_PTR * DeviceName );
  160.  const char PRT__FAR_PTR *   PRT_FUNC   PRT_GetOutName ( void );
  161.  int  PRT_FUNC   PRT_SetMargins ( int left, int top );
  162.  int  PRT_FUNC PRT_RescaleFillPattern ( int r );
  163.                         /* 0 = never, 1 = always , -1 = at high densities only */
  164.  
  165.  /* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  166.     closes PBGI, prints picture, and frees the buffer.
  167.     All above is done neccesary number of times to print
  168.     entire picture. */
  169. int PRT_FUNC PRT_PrintBGI ( int far * graphdriver, int far *graphmode,
  170.                                const char far *pathtodriver,
  171.                             int ( PRT_CFUNC *Draw)
  172.                                   (void PRT__FAR_PTR * UserPointer),
  173.                             void PRT__FAR_PTR* UserPointer );
  174.  
  175.        /* Various informing procedures */
  176.    /* May be allways called   */
  177.  int  PRT_FUNC   PRT_MaxDriver ( void );
  178.  int  PRT_FUNC   PRT_DriverName ( unsigned driverno, const char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr  );
  179.  int  PRT_FUNC   PRT_MaxMode ( unsigned driverno, int PRT__FAR_PTR *maxmode );
  180.  int  PRT_FUNC   PRT_ModeName ( unsigned driverno, int modeno,
  181.                               const char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr );
  182.  int PRT_FUNC PRT_ModeParms ( unsigned drv, unsigned mode,
  183.                               unsigned far *Xres, unsigned far *Yres,
  184.                               unsigned far *colors );
  185.  int  PRT_FUNC   PRT_DriverNo ( void );
  186.  int  PRT_FUNC   PRT_ModeNo ( void );
  187.  char far * PRT_FUNC   PRT_grapherrormsg ( int errorcode );
  188.  
  189.     /*  May be called only after PRT_SetDriver */
  190.  long PRT_FUNC   PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  191.  long PRT_FUNC   PRT_EMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  192.  long PRT_FUNC   PRT_XMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  193.  int  PRT_FUNC   PRT_MaxFitArea ( int far *dxPtr, int far *dyPtr,
  194.                                 int far *adj_xPtr, int far * adj_yPtr );
  195.  
  196.  int  PRT_FUNC   PRT_Resolution ( int PRT__FAR_PTR *Xres, int PRT__FAR_PTR *Yres );
  197.  
  198.  
  199.  /* Procedure initializes PBGI, calls Draw(), closes PBGI,
  200.     DOES NOT print picture, and DOES NOT allocate or free the buffer */
  201. int PRT_FUNC  PRT_BuildBitMap (
  202.                               int far * graphdriver, int far *graphmode,
  203.                                         const char far *pathtodriver,
  204.                               int x1,int y1, int x2,int y2,
  205.                               int ( PRT_CFUNC *Draw)
  206.                                   (void PRT__FAR_PTR * UserPointer),
  207.                               void PRT__FAR_PTR* UserPointer );
  208.  
  209. #if ForPascal
  210.    int PRT_FUNC PRT_Send( const char far *s);
  211. #else
  212.    int PRT_FUNC PRT_Send( const char far *s, unsigned slen);
  213. #endif
  214.  
  215. /* Procedures which may be called before free